/**
 */
package org.xtext.example.mydsl.componentBasedSoftwareDevelopment.impl;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import org.xtext.example.mydsl.componentBasedSoftwareDevelopment.BindComponents;
import org.xtext.example.mydsl.componentBasedSoftwareDevelopment.ComponentBasedSoftwareDevelopmentPackage;
import org.xtext.example.mydsl.componentBasedSoftwareDevelopment.ComponentInstance;
import org.xtext.example.mydsl.componentBasedSoftwareDevelopment.Contract;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Bind Components</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.xtext.example.mydsl.componentBasedSoftwareDevelopment.impl.BindComponentsImpl#getLeftComponent <em>Left Component</em>}</li>
 *   <li>{@link org.xtext.example.mydsl.componentBasedSoftwareDevelopment.impl.BindComponentsImpl#getLeftContract <em>Left Contract</em>}</li>
 *   <li>{@link org.xtext.example.mydsl.componentBasedSoftwareDevelopment.impl.BindComponentsImpl#getRightComponent <em>Right Component</em>}</li>
 *   <li>{@link org.xtext.example.mydsl.componentBasedSoftwareDevelopment.impl.BindComponentsImpl#getRightContract <em>Right Contract</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class BindComponentsImpl extends AbstractElementImpl implements BindComponents
{
  /**
   * The cached value of the '{@link #getLeftComponent() <em>Left Component</em>}' reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getLeftComponent()
   * @generated
   * @ordered
   */
  protected ComponentInstance leftComponent;

  /**
   * The cached value of the '{@link #getLeftContract() <em>Left Contract</em>}' reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getLeftContract()
   * @generated
   * @ordered
   */
  protected Contract leftContract;

  /**
   * The cached value of the '{@link #getRightComponent() <em>Right Component</em>}' reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getRightComponent()
   * @generated
   * @ordered
   */
  protected ComponentInstance rightComponent;

  /**
   * The cached value of the '{@link #getRightContract() <em>Right Contract</em>}' reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getRightContract()
   * @generated
   * @ordered
   */
  protected Contract rightContract;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected BindComponentsImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return ComponentBasedSoftwareDevelopmentPackage.Literals.BIND_COMPONENTS;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public ComponentInstance getLeftComponent()
  {
    if (leftComponent != null && leftComponent.eIsProxy())
    {
      InternalEObject oldLeftComponent = (InternalEObject)leftComponent;
      leftComponent = (ComponentInstance)eResolveProxy(oldLeftComponent);
      if (leftComponent != oldLeftComponent)
      {
        if (eNotificationRequired())
          eNotify(new ENotificationImpl(this, Notification.RESOLVE, ComponentBasedSoftwareDevelopmentPackage.BIND_COMPONENTS__LEFT_COMPONENT, oldLeftComponent, leftComponent));
      }
    }
    return leftComponent;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public ComponentInstance basicGetLeftComponent()
  {
    return leftComponent;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setLeftComponent(ComponentInstance newLeftComponent)
  {
    ComponentInstance oldLeftComponent = leftComponent;
    leftComponent = newLeftComponent;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ComponentBasedSoftwareDevelopmentPackage.BIND_COMPONENTS__LEFT_COMPONENT, oldLeftComponent, leftComponent));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Contract getLeftContract()
  {
    if (leftContract != null && leftContract.eIsProxy())
    {
      InternalEObject oldLeftContract = (InternalEObject)leftContract;
      leftContract = (Contract)eResolveProxy(oldLeftContract);
      if (leftContract != oldLeftContract)
      {
        if (eNotificationRequired())
          eNotify(new ENotificationImpl(this, Notification.RESOLVE, ComponentBasedSoftwareDevelopmentPackage.BIND_COMPONENTS__LEFT_CONTRACT, oldLeftContract, leftContract));
      }
    }
    return leftContract;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Contract basicGetLeftContract()
  {
    return leftContract;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setLeftContract(Contract newLeftContract)
  {
    Contract oldLeftContract = leftContract;
    leftContract = newLeftContract;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ComponentBasedSoftwareDevelopmentPackage.BIND_COMPONENTS__LEFT_CONTRACT, oldLeftContract, leftContract));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public ComponentInstance getRightComponent()
  {
    if (rightComponent != null && rightComponent.eIsProxy())
    {
      InternalEObject oldRightComponent = (InternalEObject)rightComponent;
      rightComponent = (ComponentInstance)eResolveProxy(oldRightComponent);
      if (rightComponent != oldRightComponent)
      {
        if (eNotificationRequired())
          eNotify(new ENotificationImpl(this, Notification.RESOLVE, ComponentBasedSoftwareDevelopmentPackage.BIND_COMPONENTS__RIGHT_COMPONENT, oldRightComponent, rightComponent));
      }
    }
    return rightComponent;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public ComponentInstance basicGetRightComponent()
  {
    return rightComponent;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setRightComponent(ComponentInstance newRightComponent)
  {
    ComponentInstance oldRightComponent = rightComponent;
    rightComponent = newRightComponent;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ComponentBasedSoftwareDevelopmentPackage.BIND_COMPONENTS__RIGHT_COMPONENT, oldRightComponent, rightComponent));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Contract getRightContract()
  {
    if (rightContract != null && rightContract.eIsProxy())
    {
      InternalEObject oldRightContract = (InternalEObject)rightContract;
      rightContract = (Contract)eResolveProxy(oldRightContract);
      if (rightContract != oldRightContract)
      {
        if (eNotificationRequired())
          eNotify(new ENotificationImpl(this, Notification.RESOLVE, ComponentBasedSoftwareDevelopmentPackage.BIND_COMPONENTS__RIGHT_CONTRACT, oldRightContract, rightContract));
      }
    }
    return rightContract;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Contract basicGetRightContract()
  {
    return rightContract;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setRightContract(Contract newRightContract)
  {
    Contract oldRightContract = rightContract;
    rightContract = newRightContract;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ComponentBasedSoftwareDevelopmentPackage.BIND_COMPONENTS__RIGHT_CONTRACT, oldRightContract, rightContract));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case ComponentBasedSoftwareDevelopmentPackage.BIND_COMPONENTS__LEFT_COMPONENT:
        if (resolve) return getLeftComponent();
        return basicGetLeftComponent();
      case ComponentBasedSoftwareDevelopmentPackage.BIND_COMPONENTS__LEFT_CONTRACT:
        if (resolve) return getLeftContract();
        return basicGetLeftContract();
      case ComponentBasedSoftwareDevelopmentPackage.BIND_COMPONENTS__RIGHT_COMPONENT:
        if (resolve) return getRightComponent();
        return basicGetRightComponent();
      case ComponentBasedSoftwareDevelopmentPackage.BIND_COMPONENTS__RIGHT_CONTRACT:
        if (resolve) return getRightContract();
        return basicGetRightContract();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case ComponentBasedSoftwareDevelopmentPackage.BIND_COMPONENTS__LEFT_COMPONENT:
        setLeftComponent((ComponentInstance)newValue);
        return;
      case ComponentBasedSoftwareDevelopmentPackage.BIND_COMPONENTS__LEFT_CONTRACT:
        setLeftContract((Contract)newValue);
        return;
      case ComponentBasedSoftwareDevelopmentPackage.BIND_COMPONENTS__RIGHT_COMPONENT:
        setRightComponent((ComponentInstance)newValue);
        return;
      case ComponentBasedSoftwareDevelopmentPackage.BIND_COMPONENTS__RIGHT_CONTRACT:
        setRightContract((Contract)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case ComponentBasedSoftwareDevelopmentPackage.BIND_COMPONENTS__LEFT_COMPONENT:
        setLeftComponent((ComponentInstance)null);
        return;
      case ComponentBasedSoftwareDevelopmentPackage.BIND_COMPONENTS__LEFT_CONTRACT:
        setLeftContract((Contract)null);
        return;
      case ComponentBasedSoftwareDevelopmentPackage.BIND_COMPONENTS__RIGHT_COMPONENT:
        setRightComponent((ComponentInstance)null);
        return;
      case ComponentBasedSoftwareDevelopmentPackage.BIND_COMPONENTS__RIGHT_CONTRACT:
        setRightContract((Contract)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case ComponentBasedSoftwareDevelopmentPackage.BIND_COMPONENTS__LEFT_COMPONENT:
        return leftComponent != null;
      case ComponentBasedSoftwareDevelopmentPackage.BIND_COMPONENTS__LEFT_CONTRACT:
        return leftContract != null;
      case ComponentBasedSoftwareDevelopmentPackage.BIND_COMPONENTS__RIGHT_COMPONENT:
        return rightComponent != null;
      case ComponentBasedSoftwareDevelopmentPackage.BIND_COMPONENTS__RIGHT_CONTRACT:
        return rightContract != null;
    }
    return super.eIsSet(featureID);
  }

} //BindComponentsImpl
